home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / macros / texinfo / C / configure < prev    next >
Text File  |  1992-09-30  |  11KB  |  433 lines

  1. #!/bin/sh
  2. # Guess values for system-dependent variables and create Makefiles.
  3. # Generated automatically using autoconf.
  4. # Copyright (C) 1991, 1992 Free Software Foundation, Inc.
  5.  
  6. # This program is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation; either version 2, or (at your option)
  9. # any later version.
  10.  
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. # GNU General Public License for more details.
  15.  
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program; if not, write to the Free Software
  18. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  
  20. # Usage: configure [--srcdir=DIR] [--host=HOST] [--gas] [--nfp] [--no-create]
  21. #        [--prefix=PREFIX] [--exec_prefix=PREFIX] [--with-PROGRAM] [TARGET]
  22. # Ignores all args except --srcdir, --prefix, --exec_prefix, and --no-create.
  23.  
  24. trap 'rm -f conftest* core; exit 1' 1 3 15
  25.  
  26. for arg
  27. do
  28.   # Handle --exec_prefix with a space before the argument.
  29.   if test x$next_exec_prefix = xyes; then exec_prefix=$arg; next_exec_prefix=
  30.   # Handle --host with a space before the argument.
  31.   elif test x$next_host = xyes; then next_host=
  32.   # Handle --prefix with a space before the argument.
  33.   elif test x$next_prefix = xyes; then prefix=$arg; next_prefix=
  34.   # Handle --srcdir with a space before the argument.
  35.   elif test x$next_srcdir = xyes; then srcdir=$arg; next_srcdir=
  36.   else
  37.     case $arg in
  38.      -exec_prefix=* | --exec_prefix=* | --exec_prefi=* | --exec_pref=* | --exec_pre=* | --exec_pr=* | --exec_p=* | --exec_=* | --exec=* | --exe=* | --ex=* | --e=*)
  39.     exec_prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  40.      -exec_prefix | --exec_prefix | --exec_prefi | --exec_pref | --exec_pre | --exec_pr | --exec_p | --exec_ | --exec | --exe | --ex | --e)
  41.     next_exec_prefix=yes ;;
  42.  
  43.      -gas | --gas | --ga | --g) ;;
  44.  
  45.      -host=* | --host=* | --hos=* | --ho=* | --h=*) ;;
  46.      -host | --host | --hos | --ho | --h)
  47.     next_host=yes ;;
  48.  
  49.      -nfp | --nfp | --nf) ;;
  50.  
  51.      -no-create | --no-create | --no-creat | --no-crea | --no-cre | --no-cr | --no-c | --no- | --no)
  52.         no_create=1 ;;
  53.  
  54.      -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
  55.     prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  56.      -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
  57.     next_prefix=yes ;;
  58.  
  59.      -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=* | --s=*)
  60.     srcdir=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  61.      -srcdir | --srcdir | --srcdi | --srcd | --src | --sr | --s)
  62.     next_srcdir=yes ;;
  63.  
  64.      -with-* | --with-*) ;;
  65.  
  66.      *) ;;
  67.     esac
  68.   fi
  69. done
  70.  
  71. rm -f conftest*
  72. compile='${CC-cc} $DEFS conftest.c -o conftest $LIBS >/dev/null 2>&1'
  73.  
  74. # A filename unique to this package, relative to the directory that
  75. # configure is in, which we can look for to find out if srcdir is correct.
  76. unique_file=makeinfo.c
  77.  
  78. # Find the source files, if location was not specified.
  79. if test -z "$srcdir"; then
  80.   srcdirdefaulted=yes
  81.   # Try the directory containing this script, then `..'.
  82.   prog=$0
  83.   confdir=`echo $prog|sed 's?/[^/][^/]*$??'`
  84.   test "X$confdir" = "X$prog" && confdir=.
  85.   srcdir=$confdir
  86.   if test ! -r $srcdir/$unique_file; then
  87.     srcdir=..
  88.   fi
  89. fi
  90. if test ! -r $srcdir/$unique_file; then
  91.   if test x$srcdirdefaulted = xyes; then
  92.     echo "configure: Can not find sources in \`${confdir}' or \`..'." 1>&2
  93.   else
  94.     echo "configure: Can not find sources in \`${srcdir}'." 1>&2
  95.   fi
  96.   exit 1
  97. fi
  98. # Preserve a srcdir of `.' to avoid automounter screwups with pwd.
  99. # But we can't avoid them for `..', to make subdirectories work.
  100. case $srcdir in
  101.   .|/*|~*) ;;
  102.   *) srcdir=`cd $srcdir; pwd` ;; # Make relative path absolute.
  103. esac
  104.  
  105. if test -z "$CC"; then
  106.   echo checking for gcc
  107.   saveifs="$IFS"; IFS="${IFS}:"
  108.   for dir in $PATH; do
  109.     test -z "$dir" && dir=.
  110.     if test -f $dir/gcc; then
  111.       CC="gcc"
  112.       break
  113.     fi
  114.   done
  115.   IFS="$saveifs"
  116. fi
  117. test -z "$CC" && CC="cc"
  118.  
  119. # Find out if we are using GNU C, under whatever name.
  120. cat <<EOF > conftest.c
  121. #ifdef __GNUC__
  122.   yes
  123. #endif
  124. EOF
  125. ${CC-cc} -E conftest.c > conftest.out 2>&1
  126. if egrep yes conftest.out >/dev/null 2>&1; then
  127.   GCC=1 # For later tests.
  128.   CC="$CC -O"
  129. fi
  130. rm -f conftest*
  131.  
  132. echo checking how to run the C preprocessor
  133. if test -z "$CPP"; then
  134.   CPP='${CC-cc} -E'
  135.   cat <<EOF > conftest.c
  136.  
  137. #include <stdio.h>
  138. EOF
  139. err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  140. if test -z "$err"; then
  141.   :
  142. else
  143.   CPP=/lib/cpp
  144. fi
  145. rm -f conftest*
  146. fi
  147.  
  148. if test -n "$GCC"; then
  149.   echo checking whether -traditional is needed
  150.   pattern="Autoconf.*'x'"
  151.   prog='#include <sgtty.h>
  152. Autoconf TIOCGETP'
  153.   cat <<EOF > conftest.c
  154.  
  155. $prog
  156. EOF
  157. eval "$CPP $DEFS conftest.c > conftest.out 2>&1"
  158. if egrep "$pattern" conftest.out >/dev/null 2>&1; then
  159.   need_trad=1
  160. fi
  161. rm -f conftest*
  162.  
  163.  
  164.   if test -z "$need_trad"; then
  165.     prog='#include <termio.h>
  166. Autoconf TCGETA'
  167.     cat <<EOF > conftest.c
  168.  
  169. $prog
  170. EOF
  171. eval "$CPP $DEFS conftest.c > conftest.out 2>&1"
  172. if egrep "$pattern" conftest.out >/dev/null 2>&1; then
  173.   need_trad=1
  174. fi
  175. rm -f conftest*
  176.  
  177.   fi
  178.   test -n "$need_trad" && CC="$CC -traditional"
  179. fi
  180.  
  181. # Make sure to not get the incompatible SysV /etc/install and
  182. # /usr/sbin/install, which might be in PATH before a BSD-like install,
  183. # or the SunOS /usr/etc/install directory.
  184. if test -z "$INSTALL"; then
  185.   echo checking for install
  186.   saveifs="$IFS"; IFS="${IFS}:"
  187.   for dir in $PATH; do
  188.     test -z "$dir" && dir=.
  189.     case $dir in
  190.     /etc|/usr/sbin|/usr/etc) ;;
  191.     *)
  192.       if test -f $dir/install; then
  193.     INSTALL="$dir/install -c"
  194.     INSTALL_PROGRAM='$(INSTALL)'
  195.     INSTALL_DATA='$(INSTALL) -m 644'
  196.     break
  197.       fi
  198.       ;;
  199.     esac
  200.   done
  201.   IFS="$saveifs"
  202. fi
  203. INSTALL=${INSTALL-cp}
  204. INSTALL_PROGRAM=${INSTALL_PROGRAM-'$(INSTALL)'}
  205. INSTALL_DATA=${INSTALL_DATA-'$(INSTALL)'}
  206.  
  207. echo checking for AIX
  208. cat <<EOF > conftest.c
  209.  
  210. #ifdef _AIX
  211.   yes
  212. #endif
  213.  
  214. EOF
  215. eval "$CPP $DEFS conftest.c > conftest.out 2>&1"
  216. if egrep "yes" conftest.out >/dev/null 2>&1; then
  217.   DEFS="$DEFS -D_ALL_SOURCE=1"
  218. fi
  219. rm -f conftest*
  220.  
  221.  
  222. echo checking for minix/config.h
  223. cat <<EOF > conftest.c
  224.  
  225. #include <minix/config.h>
  226. EOF
  227. err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  228. if test -z "$err"; then
  229.   MINIX=1
  230. fi
  231. rm -f conftest*
  232.  
  233. # The Minix shell can't assign to the same variable on the same line!
  234. if test -n "$MINIX"; then
  235.   DEFS="$DEFS -D_POSIX_SOURCE=1"
  236.   DEFS="$DEFS -D_POSIX_1_SOURCE=2"
  237.   DEFS="$DEFS -D_MINIX=1"
  238. fi
  239.  
  240. echo checking for POSIXized ISC
  241. if test -d /etc/conf/kconfig.d &&
  242.   grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1
  243. then
  244.   ISC=1 # If later tests want to check for ISC.
  245.   DEFS="$DEFS -D_POSIX_SOURCE=1"
  246.   if test -n "$GCC"; then
  247.     CC="$CC -posix"
  248.   else
  249.     CC="$CC -Xp"
  250.   fi
  251. fi
  252.  
  253. echo checking for sys/ptem.h
  254. cat <<EOF > conftest.c
  255.  
  256. #include <sys/ptem.h>
  257. EOF
  258. err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  259. if test -z "$err"; then
  260.   DEFS="$DEFS -DUSGr3=1"
  261. fi
  262. rm -f conftest*
  263.  
  264. echo checking for ANSI C header files
  265. cat <<EOF > conftest.c
  266.  
  267. #include <stdlib.h>
  268. #include <stdarg.h>
  269. #include <string.h>
  270. #include <float.h>
  271. #include <limits.h>
  272. EOF
  273. err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  274. if test -z "$err"; then
  275.   DEFS="$DEFS -DSTDC_HEADERS=1"
  276. fi
  277. rm -f conftest*
  278.  
  279. echo checking for unistd.h
  280. cat <<EOF > conftest.c
  281.  
  282. #include <unistd.h>
  283. EOF
  284. err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  285. if test -z "$err"; then
  286.   DEFS="$DEFS -DHAVE_UNISTD_H=1"
  287. fi
  288. rm -f conftest*
  289.  
  290. echo checking for BSD string and memory functions
  291. echo "#include <strings.h>
  292. main() { exit(0); } t() { rindex(0, 0); bzero(0, 0); }" > conftest.c
  293. if eval $compile; then
  294.   :
  295. else
  296.   DEFS="$DEFS -DUSG=1"
  297. fi
  298. rm -f conftest*
  299.  
  300. # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
  301. # for constant arguments.  Useless!
  302. echo checking for working alloca.h
  303. echo "#include <alloca.h>
  304. main() { exit(0); } t() { char *p = alloca(2 * sizeof(int)); }" > conftest.c
  305. if eval $compile; then
  306.   DEFS="$DEFS -DHAVE_ALLOCA_H=1"
  307. fi
  308. rm -f conftest*
  309.  
  310. decl="#ifdef __GNUC__
  311. #define alloca __builtin_alloca
  312. #else
  313. #if HAVE_ALLOCA_H
  314. #include <alloca.h>
  315. #else
  316. #ifdef _AIX
  317.  #pragma alloca
  318. #else
  319. char *alloca ();
  320. #endif
  321. #endif
  322. #endif
  323. "
  324. echo checking for alloca
  325. echo "$decl
  326. main() { exit(0); } t() { char *p = (char *) alloca(1); }" > conftest.c
  327. if eval $compile; then
  328.   :
  329. else
  330.   alloca_missing=1
  331. fi
  332. rm -f conftest*
  333.  
  334. if test -n "$alloca_missing"; then
  335.   SAVELIBS="$LIBS"
  336.   # Maybe alloca is in a different library.
  337.   #if test -f /usr/ucblib/libucb.a; then
  338.     # Avoid the broken BSD compatibility library as much as possible.
  339.     #LIBS="$LIBS -L/usr/ucblib -lc -lucb" trylib=-lucb # SVR4
  340.   #el
  341.   if test -f /lib/libPW.a; then
  342.     LIBS="$LIBS -lPW" trylib=-lPW # SVR2 and SVR3
  343.   fi
  344.   if test -n "$trylib"; then
  345.     alloca_missing=
  346.     echo checking for alloca in $trylib
  347. echo "$decl
  348. main() { exit(0); } t() { char *p = (char *) alloca(1); }" > conftest.c
  349. if eval $compile; then
  350.   :
  351. else
  352.   alloca_missing=1
  353. fi
  354. rm -f conftest*
  355.  
  356.   fi
  357.   if test -n "$alloca_missing"; then
  358.     LIBS="$SAVELIBS" ALLOCA=alloca.o
  359.   fi
  360. fi
  361.  
  362. if test -n "$prefix"; then
  363.   test -z "$exec_prefix" && exec_prefix='$(prefix)'
  364.   prsub="s?^prefix[     ]*=.*$?prefix = $prefix?"
  365. fi
  366. if test -n "$exec_prefix"; then
  367.   prsub="$prsub
  368. s?^exec_prefix[     ]*=.*$?exec_prefix = $exec_prefix?"
  369. fi
  370.  
  371. trap 'rm -f config.status; exit 1' 1 3 15
  372. echo creating config.status
  373. rm -f config.status
  374. cat <<EOF > config.status
  375. #!/bin/sh
  376. # Generated automatically by configure.
  377. # Run this file to recreate the current configuration.
  378. # This directory was configured as follows,
  379. # on host `(hostname || uname -n) 2>/dev/null`:
  380. #
  381. # $0 $*
  382.  
  383. case "\$1" in
  384.   -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
  385.   exec /bin/sh $0 $* ;;
  386. esac
  387.  
  388. trap 'rm -f Makefile; exit 1' 1 3 15
  389. CC='$CC'
  390. CPP='$CPP'
  391. INSTALL='$INSTALL'
  392. INSTALL_PROGRAM='$INSTALL_PROGRAM'
  393. INSTALL_DATA='$INSTALL_DATA'
  394. ALLOCA='$ALLOCA'
  395. LIBS='$LIBS'
  396. srcdir='$srcdir'
  397. DEFS='$DEFS'
  398. prefix='$prefix'
  399. exec_prefix='$exec_prefix'
  400. prsub='$prsub'
  401. EOF
  402. cat <<\EOF >> config.status
  403.  
  404. top_srcdir=$srcdir
  405. for file in Makefile; do
  406.   srcdir=$top_srcdir
  407.   # Remove last slash and all that follows it.  Not all systems have dirname.
  408.   dir=`echo $file|sed 's?/[^/][^/]*$??'`
  409.   if test "$dir" != "$file"; then
  410.     test "$top_srcdir" != . && srcdir=$top_srcdir/$dir
  411.     test ! -d $dir && mkdir $dir
  412.   fi
  413.   echo creating $file
  414.   rm -f $file
  415.   echo "# Generated automatically from `basename $file`.in by configure." > $file
  416.   sed -e "
  417. $prsub
  418. s?@CC@?$CC?g
  419. s?@CPP@?$CPP?g
  420. s?@INSTALL@?$INSTALL?g
  421. s?@INSTALL_PROGRAM@?$INSTALL_PROGRAM?g
  422. s?@INSTALL_DATA@?$INSTALL_DATA?g
  423. s?@ALLOCA@?$ALLOCA?g
  424. s?@LIBS@?$LIBS?g
  425. s?@srcdir@?$srcdir?g
  426. s?@DEFS@?$DEFS?" $top_srcdir/${file}.in >> $file
  427. done
  428.  
  429. EOF
  430. chmod +x config.status
  431. test -n "$no_create" || ./config.status
  432.  
  433.